package club.yuit.desktop.ui.topics;

import club.yuit.rmq.service.RMQClusterService;

import javax.swing.*;
import java.awt.*;

/**
 * @author: yuit
 * @date: 2023/12/04 19:32
 */
public class TopicListTabPanel  extends JPanel {


    private TopicCardListPanel cardListPanel;
    private TopicListControlPanel controlPanel;

    public TopicListTabPanel(RMQClusterService service) {
        cardListPanel = new TopicCardListPanel();
        controlPanel = new TopicListControlPanel(cardListPanel,service);
        JScrollPane scrollPane = new JScrollPane(cardListPanel);
        scrollPane.setBorder(null);
        scrollPane.getVerticalScrollBar().setUnitIncrement(15);

        scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        setLayout(new BorderLayout());
        cardListPanel.updateTopicsUI(service);
        add(scrollPane,BorderLayout.CENTER);
        add(controlPanel,BorderLayout.NORTH);
    }
}
